import { PlusOutlined } from '@ant-design/icons';
import { Upload } from 'antd';
import React, { useState } from 'react';

const App = () => {
  const [fileList, setFileList] = useState([]);
  const handleChange = ({ fileList: newFileList, file }) => {
    setFileList(newFileList)
    if(file.status === 'done') {
      console.log(file.response);
    }
  }
  const uploadButton = (
    <div>
      <PlusOutlined />
      <div
        style={{
          marginTop: 8,
        }}
      >
        上传
      </div>
    </div>
  );
  return (
    <div>
      <Upload
        action="/api/bannerImgUpload"
        listType="picture-card"
        fileList={fileList}
        onChange={handleChange}
        name="test"
      >
        {fileList.length >= 8 ? null : uploadButton}
      </Upload>
    </div>
  );
};

export default App;